package com.haoshuang.zhouzhoubang.ui.adapter

import com.haoshuang.zhouzhoubang.databinding.ItemAddMemberBinding
import com.haoshuang.zhouzhoubang.model.bean.GroupBean
import com.haoshuang.zhouzhoubang.ui.dialog.BjDialog3
import com.lxj.xpopup.XPopup
import com.mufeng.libs.base.BaseBindingHolder
import com.mufeng.libs.base.BaseBindingQuickAdapter
import com.mufeng.libs.utils.view.clickWithTrigger
import com.mufeng.libs.utils.view.load

/**
 *
 */
class AddMemberAdapter(data: MutableList<GroupBean.AllPeople>) :
    BaseBindingQuickAdapter<GroupBean.AllPeople, ItemAddMemberBinding>(data) {

    override fun onBindViewHolder(
        holder: BaseBindingHolder,
        position: Int,
        item: GroupBean.AllPeople?
    ) {
        holder.getViewBinding<ItemAddMemberBinding>().apply {

            ivCheck.isSelected = item?.isCHeck == 1
            ivHead.load(item?.avatar)
            tvName.text = item?.nickname
            tvService.text = item?.cate_name?.firstOrNull() ?: ""
            tvMore.clickWithTrigger {
                XPopup.Builder(context)
                    .asCustom(BjDialog3(context, (item?.cate_name?: arrayListOf())) {

                    })
                    .show()
            }
        }
    }
}
